import { Post,Controller,Get,UseGuards } from '@nestjs/common';
import { UsersService } from '../curd/user.services';
import { User } from '../models/user';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { AuthGuard } from "src/guard/auth.guard"

@ApiTags('用户模块')
@UseGuards(AuthGuard) // 管道拦截校验 token
@Controller('user')
export class UsersController {
  constructor(private usersService: UsersService) {}

  @Get('all')
  @ApiOperation({ summary: '获取所有用户' })
  @ApiResponse({ status: 200, description: '返回所有用户', type: [User] })
  async getAll(): Promise<User[]> {
    console.log('22')
    return this.usersService.findAll();
  }
}